package com.example.custom.mybatis.service.impl;

import com.example.custom.mybatis.entity.Userinfo;
import com.example.custom.mybatis.mapper.UserDao;
import com.example.custom.mybatis.service.UserinfoService;
import com.example.sources.MapperProxyFactory;

import java.util.List;

/**
 * @author liyuncong
 * @version 1.0
 * @file UserinfoServiceImpl
 * @brief UserinfoServiceImpl
 * @details UserinfoServiceImpl
 * @date 2022-11-13
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2022-11-13               liyuncong          Created
 */
public class UserinfoServiceImpl implements UserinfoService {


    @Override
    public List<Userinfo> findAllByUsername(String username) {

        final UserDao userDao = MapperProxyFactory.getMapper(UserDao.class);
        final List<Userinfo> result = userDao.findAllByUsername(username);
        return result;
    }

    @Override
    public Boolean insert(Userinfo userinfo) {
        final UserDao userDao = MapperProxyFactory.getMapper(UserDao.class);
        final int insert = userDao.insert(userinfo);
        return insert > 0;
    }
}
